!!!
%html
  /https://jsfiddle.net/vigneshmoha/bbxMe/2/
  %body
    .span15
      .container
        .col-md-12
          .row
            .page-header
              - if params[:edit] == '1'
                %h1 Edit Your Assigned Tasks.
              - else
                %h1 Assign Tasks to Job: #{@job.name}
            .row
              .col-md-10.pull-left
                Each task will be ran once
                = succeed "." do
                  %u in order selected
                You can create new tasks by selecting 'tasks' in the above menu.
      %br
      %br
      .container
        .row
          .col-md-12
            .table
              %table{class: 'table table'}
                %thead
                  %tr
                    %th
                      %b Task Name
                    %th
                      %b Type
                    %th
                      %b Control
                %tbody
                  - if @jobtasks_tasks
                    - @jobtasks_tasks.each do |jobtask|
                      %tr
                        %td
                          #{jobtask['task_name']}
                        %td
                          #{jobtask['task_type']}
                        %td
                          %a.btn.btn-success{href: "/jobs/move_task?job_id=#{@job.id}&task_id=#{jobtask['task_id']}&action=UP"}
                            %i.glyphicon.glyphicon-chevron-up{title: 'Move Up'}
                          %a.btn.btn-success{href: "/jobs/move_task?job_id=#{@job.id}&task_id=#{jobtask['task_id']}&action=DOWN"}
                            %i.glyphicon.glyphicon-chevron-down{title: 'Move Down'}
                          %a.btn.btn-danger{href: "/jobs/remove_task?job_id=#{@job.id}&jobtask_id=#{jobtask['jobtask_id']}"}
                            %i.glyphicon.glyphicon-trash{title: 'Delete'}
                        %tr
                  %tr
                    %td
                      %label.control-label{for: ''}
                      .btn-group
                        .btn.btn-default.dropdown-toggle{"data-toggle" => 'dropdown'}
                          Add Task
                          %span.caret
                        %ul.dropdown-menu.dropdown-menu-left
                          - @available_tasks.each do |task|
                            %li
                              %a{href: "/jobs/assign_task?job_id=#{@job.id}&task_id=#{task['id']}"} #{task['name']}
                    %td
                    %td
      .container
        .row
          .col-md-12
            %a.btn.btn-primary{href: "/jobs/complete?job_id=#{@job.id}"}
              Done